package com.myfoon.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "EVENT_USER")
public class EventUser implements Serializable {
    private Long id;
    private Event event;
    private User user;
    
    public EventUser() {
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Id 
    @GeneratedValue(generator = "EventUserSequence", strategy = GenerationType.AUTO)
    @SequenceGenerator(name = "EventUserSequence", allocationSize = 1, sequenceName = "EVENT_USER_SEQ_01")
    @Column(name = "ID")    
    public Long getId() {
        return id;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "EVENT_ID")
    public Event getEvent() {
        return event;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USER_ID")
    public User getUser() {
        return user;
    }
}
